<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h1>发送消息</h1>
        <input placeholder="接收者" id="to">
        <input placeholder="消息内容" id="msg">
        <input type="button" value="发送" id="sendMsg">
    <h1>联系人列表</h1>
    <p>好友个数：{{ contact_res.MemberCount }}</p>

    {% for user in contact_res.MemberList %}
        <div username="{{ user.UserName  }}">
{#        <img style="width: 20px;height: 20px" src="/avatar.html?imgUrl={{ user.HeadImgUrl }}">#}
            <span>
            {{ user.RemarkName }}
            {{ user.NickName }}
            {{ user.Signature }}
            </span>
        </div>
    {% endfor %}
    </ul>
    <script src="/static/jquery-1.12.4.js"></script>
    <script>
        $(function () {
            $('#sendMsg').click(function () {
                $.ajax({
                    url:'/send_msg.html',
                    type: 'post',
                    data: {'to':$('#to').val(), 'msg':$('#msg').val()},
                    success: function (arg) {
                        alert(arg);
                    }
                })
            });
            getMsg();
        });
        function getMsg() {
            $.ajax({
                url: '/get_msg.html',
                type: 'GET',
                success: function (arg) {
                    getMsg();

                }
            })
        }
    </script>
</body>
</html>